import Vue from 'vue'
import Router from 'vue-router'


Vue.use(Router)

export default new Router({
    mode: 'history',
    routes: [{
        path: '/404',
        name: '404',
        meta: {
            pathName: '404',
            title: '404'
        },
        component: resolve => require(['@/view/404.vue'], resolve)
    },
        {
            path: '/random',
            name: 'random',
            meta: {
                pathName: 'random',
                title: '随机'
            },
            component: resolve => require(['@/components/HelloWorld.vue'], resolve)
        },
        {
            path: '/nav',
            name: 'nav',
            meta: {
                pathName: 'random',
                title: '随机'
            },
            component: resolve => require(['@/components/x-nav.vue'], resolve)
        },
        {
            path: '/',
            name: 'index',
            meta: {
                pathName: 'index',
                title: '主页'
            },
            component: resolve => require(['@/view/index.vue'], resolve)
        },
        {
            path: '/bs',
            name: 'index',
            meta: {
                pathName: 'index',
                title: 'bs首页' +
                    ''
            },
            component: resolve => require(['@/view/index.vue'], resolve)
        },
        {
            path: '/login',
            name: 'login',
            meta: {
                pathName: 'login',
                title: '登录页' +
                    ''
            },
            component: resolve => require(['@/view/login.vue'], resolve)
        },
        {
            path: '/cart',
            name: 'cart',
            meta: {
                pathName: 'cart',
                title: '购物车' +
                    ''
            },
            component: resolve => require(['@/view/cart.vue'], resolve)
        },
        {
            path: '/loginManage',
            name: 'loginManage',
            meta: {
                pathName: 'loginManage',
                title: '管理员登录' +
                    ''
            },
            component: resolve => require(['@/view/loginManage.vue'], resolve)
        },
        {
            path: '/manage',
            name: 'manage',
            meta: {
                pathName: 'manage',
                title: '管理员页面' +
                    ''
            },
            component: resolve => require(['@/view/manage.vue'], resolve),
            children: [{
                path: '/manageOrder',
                name: 'manageOrder',
                meta: {
                    pathName: 'manageOrder',
                    title: '管理员页面' + '',
                },
                component: resolve => require(['@/view/manageOrder.vue'], resolve),
            }, {
                    path: '/userList',
                    name: 'userList',
                    meta: {
                        pathName: 'userList',
                        title: '订单列表' +
                            ''
                    },
                    component: resolve => require(['@/view/userList.vue'], resolve)
                },
                {
                    path: '/goodsList',
                    name: 'goodsList',
                    meta: {
                        pathName: 'goodsList',
                        title: '订单列表' +
                            ''
                    },
                    component: resolve => require(['@/view/goodsList.vue'], resolve)
                },
                {
                    path: '/goodUpdate',
                    name: 'goodUpdate',
                    meta: {
                        pathName: 'goodUpdate',
                        title: '订单列表' +
                            ''
                    },
                    component: resolve => require(['@/view/goodUpdate.vue'], resolve)
                },
            ]
        }
    ]
})